<template>
	<view @click.stop="clickBtnHandler"
		:class="{actionBtn: true, actionBtn0: position == 0, actionBtn1: position == 1, actionBtn2: position == 2, actionBtn3: position == 3 }"
		v-if="judgeGopayOrQianyue()">
		查看物流
	</view>
</template>

<script>
	// 查看物流按钮
	import {
		checkPosition,
		getOrderId
	} from "../utils/checkShowBtn.js"

	export default {
		name: "chakanwuliu",

		props: {
			order: {
				type: Object,
				default: {},
			}, // 订单对象
			isUsedInList: {
				type: Boolean,
				default: true,
			}, // 是否使用在订单列表页面
			isUsedInMore: {
				type: Boolean,
				default: false,
			}, // 是否使用在省略号中
		},

		data() {
			return {}
		},
		mounted() {},

		computed: {
			position: function() {
				if (this.order.isSendHuo == 1 || this.order.status == '06') {
					//isSendHuo==1:部分发货，把状态变成05待发货，显示物流按钮
					// this.order.status = '05'
				}
				return checkPosition.chakanwuliu(this.order, this.isUsedInList)
			}
		},

		methods: {
			//判断按钮是否出现
			judgeGopayOrQianyue() {
				if (this.order.status == '05' || this.order.status == '06' || this.order.status == '09') {
					return true
				} else {
					return false
				}
			},
			/**
			 * 监听点击按钮
			 */
			clickBtnHandler() {
				const orderId = getOrderId(this.order) // 订单ID
				console.log("点击了查看物流信息111111111", orderId)
				this.$onTo(`/pagesInfo/logistics-rich/logistics-rich?orderId=${orderId}`) // 跳转到物流详情页面
			}
		}
	}
</script>

<style>
	.actionBtn {
		width: 138rpx;
		height: 56rpx;
		border-radius: 30rpx;
		border: 1px solid #c0c0c0;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 24rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #666666;
		margin-left: 24rpx;
		flex-shrink: 0;
		float: right;
		// position: absolute;
	}

	.actionBtn {
		position: relative;
	}
</style>